package Junit;

import java.util.ArrayList;
import java.util.concurrent.ArrayBlockingQueue;

import server.ReportController;
import junit.framework.TestCase;

public class ActivityReportTest extends TestCase {
	
	private ReportController reportController;
	
	private ArrayList<Integer> input;
	private ArrayList<Object> output;

	
	public ActivityReportTest() {
		reportController = new ReportController();
		input = new ArrayList<Integer>();
		
		
		
	}
	
	public void testValidMedianImpairInput(){

		input.add(10);
		input.add(20);
		input.add(30);
		input.add(40);
		input.add(50);
		
		output = reportController.ComputeStatistics(input);
		
		int actualMedian = (Integer)output.get(1);
		int expectedMedian = 30;
		
		assertEquals(expectedMedian,actualMedian);
	}
	
	public void testValidMedianPairInput(){

		input.add(10);
		input.add(20);
		input.add(30);
		input.add(40);
		input.add(50);
		input.add(60);
		
		output = reportController.ComputeStatistics(input);
		
		int actualMedian = (Integer)output.get(1);
		int expectedMedian = 40;
		
		assertEquals(expectedMedian,actualMedian);
	}
	
	
	public void testInvalidMedian(){
		input.add(11);
		input.add(12);
		input.add(13);
		input.add(14);
		input.add(15);
		
		output = reportController.ComputeStatistics(input);
		
		int actualMedian = (Integer)output.get(1);
		int expectedMedian = 50;
		
		assertTrue(expectedMedian != actualMedian);
	}
	
	
	public void testValidAverage(){

		input.add(13);
		input.add(23);
		input.add(24);
		input.add(32);
		input.add(16);
		
		output = reportController.ComputeStatistics(input);
		
		float actualAverage = (Float)output.get(0);
		float expectedAverage = 21.6f;
		
		assertEquals(expectedAverage,actualAverage,0.1);
	}
	
	
	public void testInvalidAverage(){
		
		input.add(13);
		input.add(23);
		input.add(24);
		input.add(32);
		input.add(16);
		
		output = reportController.ComputeStatistics(input);
		
		float actualAverage= (Float)output.get(0);
		float expectedAverage = 21.7f;
		
		assertTrue(expectedAverage != actualAverage);
	}
	
	
	
	
	


}
